<?php
include('../adodb5/adodb.inc.php');
$db = ADONewConnection("mysql"); # eg 'mysql' or 'postgres'
$db->Connect("localhost", "root", "112233", "test");     

$content = "
<form action=\"\" method=\"post\">
Firstname
<br/>
<input type=\"text\" name=\"firstname\">
<br/>
Lastname<br/>
<input type=\"text\" name=\"lastname\"><br/>
Age<br/>
<input type=\"text\" name=\"age\"><br/>
<input type=\"submit\" name=\"submit\" value=\"Simpan\">
";

if(isset($_POST['submit'])){
	if(!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['age'])){
		$query = "insert into customer (firstname,lastname,age) values('".addslashes($_POST['firstname'])."','".addslashes($_POST['lastname'])."','".addslashes($_POST['age'])."')";
		$rs = $db->Execute($query);
		if($rs === false){
			$content.="<strong>Insert gagal</strong><br/>".$content;
			echo $content;
		} else {
			echo "<strong>Insert berhasil</strong> <a href=\"listarray.php\">List Data</a>";
		}
	}
} else {
	echo $content;
}
?>